﻿window.addEvent('domready', function () {
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
//    checkShowPopUp();

});




function showPopUp(id) {

    getInfoParticipante(id);
    var popUp = $('popUpInfoParticipantes');
    if (popUp) {
        popUp.setStyle('display', 'block');
        var scroll = window.getScroll();
        var popUpHeight = popUp.getSize().y;
        if (popUpHeight + 200 >= window.getSize().y) {
            popUp.set('tween', { duration: 'short' });
            popUp.tween('top', 15 + scroll.y);
        }
        else {
            popUp.setStyles({
                top: 200 + scroll.y
            });
        }
        popUp.setStyles({
            left: ((window.getCoordinates().width - popUp.getCoordinates().width) / 2)
        });
    }
}

function closePopUp() {
    var popUp = $('popUpInfoParticipantes');
    if (popUp) {
        popUp.setStyle('display', 'none');
    }

}

function getInfoParticipante(id) {

    var divContentInfoPart = $('contentInfoParticipante');
    if (divContentInfoPart) {
        divContentInfoPart.set('html', 'Cargando info...');
    }

    new Request.HTML({
        'url': '/HandlersHtml/GetInfoParticipante.ashx',
        'onSuccess': function (responseTree, responseElements, responseHTML, responseJavaScript) {
            var response = responseHTML;
            var divContentInfoPart = $('contentInfoParticipante');
            if (divContentInfoPart) {
                divContentInfoPart.set('html', response);
            }
        },
        'onFailure': function (reqObj) {
            alert('No se puede ver la informacion');
        }
    }).post({ 'id': id });
}   